﻿#region Copyright

// Majesty of Omega - The next evolution of macro management space strategy
// 
// Copyright 2007-2009 André Claaßen
// 
// This file is protected by the terms and conditions of the
// Microsoft Community License (Ms-CL 1.1), a copy of which should
// have been distributed along with this software. If not,
// you may find the license information at the following URL:
// 
// http://www.microsoft.com/resources/sharedsource/licensingbasics/communitylicense.mspx

#endregion

#region

using System.ComponentModel;
using System.Windows;
using Majesty_of_Omega.Config;
using Majesty_of_Omega.GUI.Utility;
using Majesty_of_Omega.GUI.Utility.Supremacy.Client;

#endregion

namespace Majesty_of_Omega.GUI
{
    /// <summary>
    /// The purpose of the frameless application window is to startup Majesty Of Omega in full size without borders
    /// </summary>
    public partial class GameWindow
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="GameWindow"/> class.
        /// </summary>
        public GameWindow()
        {
            InitializeComponent();
            SetApplicationTitle();
            Loaded += GameWindow_Loaded;
            Closing += GameWindow_Closing;
        }

        /// <summary>
        /// Handles the Closing event of the GameWindow control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.ComponentModel.CancelEventArgs"/> instance containing the event data.</param>
        private static void GameWindow_Closing(object sender, CancelEventArgs e)
        {
            AudioEngine.Instance.Stop();
        }

        /// <summary>
        /// Handles the Loaded event of the GameWindow control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private static void GameWindow_Loaded(object sender, RoutedEventArgs e)
        {
#if !NOMUSIC
            AudioEngine.Instance.Start(MusicPack.TrackId.TitleScreen);
#endif
        }

        /// <summary>
        /// Sets the application title.
        /// </summary>
        private void SetApplicationTitle()
        {
            Title = "Majesty of Omega - " + MyApplicationInfo.ApplicationVersion;
        }
 
    }
}